//
//(C) Copyright 2011 HongKong Airline.,Ltd. 
//
/**
 * commodityServiceImpl
 * 项目名称:代购系统
 *
 * @author Mengxiangliang
 *
 * 功能描述:
 * 
 * 历史版本:2013-01-04 v1.0.0 Mengxiangliang  创建:
 * 
 */
 
package com.gamutsoft.amb.commodity.service.impl;

import java.util.List;
import java.util.Map;

import com.gamutsoft.amb.commodity.dao.ICommodityDao;
import com.gamutsoft.amb.commodity.model.Commodity;
import com.gamutsoft.amb.commodity.service.ICommodityService;
import com.gamutsoft.amb.common.bean.QueryExample;
import com.gamutsoft.amb.common.exception.BusinessException;
import com.gamutsoft.amb.common.service.impl.GenericServiceImpl;

public class CommodityServiceImpl extends GenericServiceImpl<Commodity, Long> implements ICommodityService {
	public ICommodityDao commodityDao;

    public CommodityServiceImpl(ICommodityDao commodityDao) {
		super(commodityDao);
		this.commodityDao = commodityDao;
	}
	
	/**
	 * 根据条件查询记录
	 * @author Mengxiangliang
	 * @param  QueryExample
	 * @return CommodityList
	 * @throws BusinessException
	 */
	public List<Map> searchCommodityList(QueryExample qe) throws BusinessException{
	  
	   return commodityDao.searchCommodityList(qe);
	   
	}
	
	/**
	 * 根据ID查询记录
	 * @author Mengxiangliang
	 * @param Long id
	 * @return domain
	 * @throws BusinessException
	 */
	public Commodity searchCommodityById(Long id) throws BusinessException{
	  
	   return commodityDao.searchCommodityById(id);
	   
	}

	/**
	 *  删除记录
	 * @author Mengxiangliang	 
	 * @param id
	 * @throws BusinessException
	 */
	public void deleteCommodityById(Long id) throws BusinessException{
	 
	  commodityDao.deleteCommodityById(id);
	  
	}
	
	/**
	 * 修改记录
	 * @author Mengxiangliang
	 * @param domain
	 * @throws BusinessException
	 */
	public void updateCommodity(Commodity domain) throws BusinessException{
	
	   commodityDao.save(domain);
	   
	}

	/**
	 * 新增记录
	 * @author Mengxiangliang
	 * @param domain
	 * @return
	 * @throws BusinessException
	 */
	public void createCommodity(Commodity domain) throws BusinessException{
	
	   commodityDao.save(domain);
	}

	@Override
	public List<Commodity> searchByOrderId(Long orderId)
			throws BusinessException {
		// TODO Auto-generated method stub
		return commodityDao.searchByOrderId(orderId);
	}
	

}